import VueRouter from 'vue-router';
import Vue from 'vue';
import employees from './employees.js'


Vue.use(VueRouter);

// 静态和动态路由
//静态:所有人都要路由
const constantRoutes = [
    {
        path: '/',
        component: () => import('../pages/homepage'),
        children: [
            { path: '/', component: () => import('../pages/dashboard') },
        ],
        meta: {
            icon: 'el-icon-eleme',
            label: '首页',
        }
    },
    // 导入导出,写法2.分开写
    {
        path: '/import',
        component: () => import('../pages/homepage'),
        children: [
            { path: '', component: () => import('../pages/import/index.vue') }
        ],
        hidden: true
    },
    { path: '/login', component: () => import('../pages/login'), hidden: true },


]
//动态:需要响应权限才可以访问的路由
const asyncRoutes = [
    {
        path: '/departments',
        component: () => import('../pages/homepage'), children: [
            { path: '', component: () => import('../pages/departments') }
        ],
        meta: {
            icon: 'el-icon-shopping-cart-2',
            label: '组织架构',
        }
    },
    {
        path: '/approvals',
        component: () => import('../pages/homepage'), children: [
            { path: '', component: () => import('../pages/approvals') }
        ],
        meta: {
            icon: 'el-icon-user',
            label: '审批'
        }
    },
    {
        path: '/attendances',
        component: () => import('../pages/homepage'), children: [
            { path: '', component: () => import('../pages/attendances') }
        ],
        meta: {
            icon: 'el-icon-user',
            label: '出勤',
        }
    },
    {
        path: '/permissions',
        component: () => import('../pages/homepage'), children: [
            { path: '', component: () => import('../pages/permissions') }
        ],
        meta: {
            icon: 'el-icon-user',
            label: '权限',
        }
    },
    {
        path: '/salary',
        component: () => import('../pages/homepage'), children: [
            { path: '', component: () => import('../pages/salary') }
        ],
        meta: {
            icon: 'el-icon-user',
            label: '工资',
        }
    },
    {
        path: '/settings',
        component: () => import('../pages/homepage'), children: [
            { path: '', component: () => import('../pages/settings') }
        ],
        meta: {
            icon: 'el-icon-user',
            label: '设置',
        }
    },
    {
        path: '/social_securitys',
        component: () => import('../pages/homepage'), children: [
            { path: '', component: () => import('../pages/social_securitys') }
        ],
        meta: {


        }
    },
    employees
]
const routes = [
    ...constantRoutes,
    ...asyncRoutes
]

// const routes = [
//     {
//         path: '/',
//         component: () => import('../pages/homepage'),
//         children: [
//             {
//                 path: '/',
//                 component: () => import('../pages/dashboard')
//             },
            
//             {
//                 path: '/settings',
//                 component: () => import('../pages/settings')
//             },
//             {
//                 path: '/social_securitys',
//                 component: () => import('../pages/social_securitys')
//             },
//             {
//                 path: '/permissions',
//                 component: () => import('../pages/permissions')
//             },
//             {
//                 path: '/approvals',
//                 component: () => import('../pages/approvals')
//             },
//             {
//                 path: '/departments',
//                 component: () => import('../pages/departments')
//             },
//             {
//                 path: '/salarys',
//                 component: () => import('../pages/salarys')
//             },
//             {
//                 path: '/attendances',
//                 component: () => import('../pages/attendances')
//             },
//         ],
//     },
//     // {
//     //     path: '/employees',
//     //     component: () => import('../pages/homepage'),
//     //     children: [
//     //         {
//     //             path: '',
//     //             component: () => import('../pages/import')
//     //         },
//     //         {
//     //             path: 'detail/:id?',
//     //             component: () => import('../pages/employees/components/detail')
//     //         },
//     //     ]
//     // },
//     employees,
//     {
//         path: '/import',
//         component: () => import('../pages/homepage'),
//         children: [
//             {
//                 path: '', // 二级路由path什么都不写 表示二级默认路由
//                 component: () => import('../pages/import')
//             },
//         ]
//     },
//     {
//         path: '/login',
//         component: () => import('../pages/login')
//     },
//     {
//         path: '/register',
//         component: () => import('../pages/register')
//     },
// ];

export default new VueRouter({ routes });
